package scala.examples.fs;

object Debug {
  //System.out//
  val n=System.out //new java.io.PrintStream(new java.io.File("/tmp/fs.log"))
  val e=System.err

  object eval extends Debug("", n, e)
  object tcheck extends Debug("", n, e)
  object syntax extends Debug("", n, e)

}

class Debug(prefix: String, normal: java.io.PrintStream, error: java.io.PrintStream ) {
  def log[t,a](x: t): a = {pre(normal); normal.println(x); null}
  def error[t,a](x: t): a = {pre(error); error.println(x); null}
  val header = prefix//+" "
  def pre(ps: java.io.PrintStream) = ps.print(header)
}